Skip to content

Commit

Permalink
Merge pull request microsoft#622 from SimonSiefke/feature/modernize-e…
Browse files Browse the repository at this point in the history
…xample-code

feature: modernize example code
  • Loading branch information
Tyriar authored Jul 27, 2023
2 parents 5f385f6 + 1f284fa commit 2f0f67d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ The full API for node-pty is contained within the [TypeScript declaration file](
## Example Usage

```js
var os = require('os');
var pty = require('node-pty');
import * as os from 'node:os';
import * as pty from 'node-pty';

var shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';
const shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';

var ptyProcess = pty.spawn(shell, [], {
const ptyProcess = pty.spawn(shell, [], {
name: 'xterm-color',
cols: 80,
rows: 30,
Expand Down
10 changes: 5 additions & 5 deletions examples/fork/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
var os = require('os');
var pty = require('../..');
import * as os from 'node:os';
import * as pty from '../../lib/index.js';

var isWindows = os.platform() === 'win32';
var shell = isWindows ? 'powershell.exe' : 'bash';
const isWindows = os.platform() === 'win32';
const shell = isWindows ? 'powershell.exe' : 'bash';

var ptyProcess = pty.spawn(shell, [], {
const ptyProcess = pty.spawn(shell, [], {
name: 'xterm-256color',
cols: 80,
rows: 26,
Expand Down
3 changes: 3 additions & 0 deletions examples/fork/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}

0 comments on commit 2f0f67d

Please sign in to comment.