Skip to content
This repository was archived by the owner on Jan 23, 2021. It is now read-only.

Commit 2fa41df

Browse files
committed
0 parents  commit 2fa41df

10 files changed

Lines changed: 150 additions & 0 deletions

File tree

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
end_of_line = lf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[{package.json,*.yml}]
11+
indent_style = space
12+
indent_size = 2
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.jshintrc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"node": true,
3+
"esnext": true,
4+
"bitwise": true,
5+
"curly": true,
6+
"immed": true,
7+
"newcap": true,
8+
"noarg": true,
9+
"undef": true,
10+
"unused": "vars",
11+
"strict": true
12+
}

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
sudo: false
2+
language: node_js
3+
node_js:
4+
- 'iojs'
5+
- '0.12'
6+
- '0.10'

index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
var childProcess = require('child_process');
3+
var ctor;
4+
5+
module.exports = function () {
6+
if (typeof childProcess.ChildProcess === 'function') {
7+
return childProcess.ChildProcess;
8+
}
9+
10+
if (ctor !== undefined) {
11+
return ctor;
12+
}
13+
14+
var cp = childProcess.spawn(process.execPath);
15+
cp.kill('SIGKILL');
16+
ctor = cp.constructor;
17+
18+
return ctor;
19+
};

license

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

package.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "child-process-ctor",
3+
"version": "0.0.0",
4+
"description": "Node.js childProcess.ChildProcess ponyfill",
5+
"license": "MIT",
6+
"repository": "sindresorhus/child-process-ctor",
7+
"author": {
8+
"name": "Sindre Sorhus",
9+
"email": "sindresorhus@gmail.com",
10+
"url": "sindresorhus.com"
11+
},
12+
"engines": {
13+
"node": ">=0.10.0"
14+
},
15+
"scripts": {
16+
"test": "node test.js"
17+
},
18+
"files": [
19+
"index.js"
20+
],
21+
"keywords": [
22+
"built-in",
23+
"core",
24+
"ponyfill",
25+
"polyfill",
26+
"shim",
27+
"child",
28+
"process",
29+
"childprocess",
30+
"constructor",
31+
"ctor"
32+
],
33+
"devDependencies": {
34+
"ava": "0.0.4"
35+
}
36+
}

readme.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# child-process-ctor [![Build Status](https://travis-ci.org/sindresorhus/child-process-ctor.svg?branch=master)](https://travis-ci.org/sindresorhus/child-process-ctor)
2+
3+
> Node.js `childProcess.ChildProcess` ponyfill
4+
5+
> Ponyfill: A polyfill that doesn't overwrite the native method
6+
7+
The `ChildProcess` constructor weren't previously easily exposed. This is most likely going to [change soon](https://github.com/nodejs/io.js/pull/1760).
8+
9+
10+
## Install
11+
12+
```
13+
$ npm install --save child-process-ctor
14+
```
15+
16+
17+
## Usage
18+
19+
```js
20+
var childProcessCtor = require('child-process-ctor');
21+
22+
console.log(typeof childProcessCtor().prototype.spawn);
23+
//=> 'function'
24+
```
25+
26+
27+
## License
28+
29+
MIT © [Sindre Sorhus](http://sindresorhus.com)

test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
var test = require('ava');
3+
var childProcessCtor = require('./');
4+
5+
test(function (t) {
6+
var ctor = childProcessCtor();
7+
t.assert(ctor.name === 'ChildProcess');
8+
t.assert(typeof ctor.prototype.spawn === 'function');
9+
t.end();
10+
});

0 commit comments

Comments
 (0)