FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
atom/src/buffered-node-process.coffee at master · r3n4ud/atom · GitHub
r3n4ud
/
atom
Public
forked from
atom/atom
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
atom
/
src
/
buffered-node-process.coffee
Copy path
More file actions
More file actions
Latest commit
History
History
History
51 lines (48 loc) · 2.28 KB
Breadcrumbs
atom
/
src
/
buffered-node-process.coffee
Copy path
File metadata and controls
51 lines (48 loc) · 2.28 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
BufferedProcess
=
require
'
./buffered-process
'
path
=
require
'
path
'
#
Public: Like {BufferedProcess}, but accepts a Node script as the command
#
to run.
#
#
This is necessary on Windows since it doesn't support shebang `#!` lines.
#
#
## Requiring in packages
#
#
```coffee
#
{BufferedNodeProcess} = require 'atom'
#
```
module
.
exports
=
class
BufferedNodeProcess
extends
BufferedProcess
#
Public: Runs the given Node script by spawning a new child process.
#
#
options - An {Object} with the following keys:
#
:command - The {String} path to the JavaScript script to execute.
#
:args - The {Array} of arguments to pass to the script (optional).
#
:options - The options {Object} to pass to Node's `ChildProcess.spawn`
#
method (optional).
#
:stdout - The callback {Function} that receives a single argument which
#
contains the standard output from the command. The callback is
#
called as data is received but it's buffered to ensure only
#
complete lines are passed until the source stream closes. After
#
the source stream has closed all remaining data is sent in a
#
final call (optional).
#
:stderr - The callback {Function} that receives a single argument which
#
contains the standard error output from the command. The
#
callback is called as data is received but it's buffered to
#
ensure only complete lines are passed until the source stream
#
closes. After the source stream has closed all remaining data
#
is sent in a final call (optional).
#
:exit - The callback {Function} which receives a single argument
#
containing the exit status (optional).
constructor
:
({command, args, options, stdout, stderr, exit})
->
node
=
if
process
.
platform
is
'
darwin
'
#
Use a helper to prevent an icon from appearing on the Dock
path
.
resolve
(
process
.
resourcesPath
,
'
..
'
,
'
Frameworks
'
,
'
Atom Helper.app
'
,
'
Contents
'
,
'
MacOS
'
,
'
Atom Helper
'
)
else
process
.
execPath
options
?=
{}
options
.
env
?=
Object
.
create
(
process
.
env
)
options
.
env
[
'
ATOM_SHELL_INTERNAL_RUN_AS_NODE
'
]
=
1
args
.
unshift
(command)
super
({
command
:
node, args, options, stdout, stderr, exit})
Back
|
FazBrowse Home
|
New Git URL