child_process
module allows user to execute external processes. For example, you can
comunicate external applications (like notepad++) installed in your system.
var exec = require('child_process').exec; var applicationName = 'notepad'; exec(applicationName);
When
you execute above application in windows environment, it opens notepad
application.
Signature
of exec function looks like below.
child_process.exec(command[,
options][, callback])
Below
table summarizes the arguments of exec function.
Argument
|
Type
|
Description
|
|||||||||||||||||||||||||||||||||
command
|
String
|
Command
to execute
|
|||||||||||||||||||||||||||||||||
Options
|
Object
|
Below
table summarizes different options provided by exec command.
|
|||||||||||||||||||||||||||||||||
callback
|
Function
|
Function
to be called, when the process terminates. This function takes three
arguments.
Below
table summarizes the arguments of callback function.
On
success, error will be null. On error, error will be an instance of Error.
stdout
and stderr objects represents the stdout and stderr output of the child
process.
|
No comments:
Post a Comment