Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be1d70f
commit c2f5edf
Showing
33 changed files
with
276 additions
and
80 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
const execa = require('../..'); | ||
|
||
const subprocess = execa('node', ['./test/fixtures/forever'], {detached: true}); | ||
console.log(subprocess.pid); | ||
process.exit(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
console.log(process.argv.slice(2).join('\n')); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
0
fixtures/hello.cmd → test/fixtures/hello.cmd
100644 → 100755
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
echo Hello World |
File renamed without changes.
0
fixtures/no-killable → test/fixtures/no-killable
100644 → 100755
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
process.on('message', message => { | ||
if (message === 'ping') { | ||
process.send('pong'); | ||
} else { | ||
throw new Error('Receive wrong message'); | ||
} | ||
}); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
const execa = require('..'); | ||
const execa = require('../..'); | ||
|
||
const cleanup = process.argv[2] === 'true'; | ||
const detached = process.argv[3] === 'true'; | ||
const subprocess = execa('node', ['./fixtures/forever'], {cleanup, detached}); | ||
const subprocess = execa('node', ['./test/fixtures/forever'], {cleanup, detached}); | ||
process.send(subprocess.pid); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
const execa = require('..'); | ||
const execa = require('../..'); | ||
|
||
const cleanup = process.argv[2] === 'true'; | ||
const detached = process.argv[3] === 'true'; | ||
execa('node', ['./fixtures/noop'], {cleanup, detached}); | ||
execa('node', ['./test/fixtures/noop'], {cleanup, detached}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import test from 'ava'; | ||
import pEvent from 'p-event'; | ||
import path from 'path'; | ||
import execa from '..'; | ||
|
||
process.env.PATH = path.join(__dirname, 'fixtures') + path.delimiter + process.env.PATH; | ||
|
||
test('node()', async t => { | ||
const {exitCode} = await execa.node('test/fixtures/noop'); | ||
t.is(exitCode, 0); | ||
}); | ||
|
||
test('node pipe stdout', async t => { | ||
const {stdout} = await execa.node('test/fixtures/noop', ['foo'], { | ||
stdout: 'pipe' | ||
}); | ||
|
||
t.is(stdout, 'foo'); | ||
}); | ||
|
||
test('node correctly use nodePath', async t => { | ||
const {stdout} = await execa.node(process.platform === 'win32' ? 'hello.cmd' : 'hello.sh', { | ||
stdout: 'pipe', | ||
nodePath: process.platform === 'win32' ? 'cmd.exe' : 'bash', | ||
nodeArguments: process.platform === 'win32' ? ['/c'] : [] | ||
}); | ||
|
||
t.is(stdout, 'Hello World'); | ||
}); | ||
|
||
test('node pass on nodeArguments', async t => { | ||
const {stdout} = await execa.node('console.log("foo")', { | ||
stdout: 'pipe', | ||
nodeArguments: ['-e'] | ||
}); | ||
|
||
t.is(stdout, 'foo'); | ||
}); | ||
|
||
test('node\'s forked script has a communication channel', async t => { | ||
const subprocess = execa.node('test/fixtures/send'); | ||
subprocess.send('ping'); | ||
|
||
const message = await pEvent(subprocess, 'message'); | ||
t.is(message, 'pong'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.