Execute commands from typescript
<p>I want to execute command on the server on which <strong>angularjs2</strong> application using <strong>typescript</strong> is deployed. Commands are simple like:</p>

<pre><code>java --version
</code></pre>

<p>and want to get response of the command.</p>

<p>I don't know, is it possible or not.</p>

<p>Thanks in Advance!!</p>

<p>Edit:
Getting error:</p>

<pre><code>zone.js:260 Uncaught EXCEPTION: Error in ./AppComponent class AppComponent - inline template:8:48
ORIGINAL EXCEPTION: ReferenceError: require is not defined
ORIGINAL STACKTRACE:
ReferenceError: require is not defined
    at AppComponent.performCmdOperation (http://localhost:8000/app/app.component.js:43:67)
</code></pre>

<p>and </p>

<blockquote>
  <p>app.component.ts</p>
</blockquote>

<p>is</p>

<pre><code>export class AppComponent{

SelectType = EnumSelectType;
selectedSection: SelectType = EnumSelectType[EnumSelectType.Home];
selectPage(selectType:EnumSelectType) {
    console.log('Global : ' + EnumSelectType[selectType]);
    this.selectedSection = EnumSelectType[selectType];
    console.log(this.selectedSection + ' selected');
}

performCmdOperation(){
    console.log('in perform action');
    const exec = require('sdk/system/child_process').exec; //this is the point where I'm getting error.
    exec('ipconfig', (error, stdout, stderr) =&gt; {
        if (error) {
            console.error(`exec error: ${error}`);
            return;
        }
        console.log(`stdout: ${stdout}`);
        console.log(`stderr: ${stderr}`);
    });
}
</code></pre>

<p>Please help me finding the issue. Is there any <code>import missing or any dependency</code> required for using <strong>'child_process'</strong>.</p>

<p>My current dependencies are </p>

<pre><code>"bootstrap": "^3.3.6",

"@angular/common": "2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@angular/http": "2.0.0-rc.4",
"@angular/platform-browser": "2.0.0-rc.4",
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
"@angular/router": "2.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.1",
"@angular/upgrade": "2.0.0-rc.4",

"systemjs": "0.19.27",
"es6-shim": "^0.35.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12"
</code></pre>

<p>If this is something for which need to modify <strong>gulpfile.ts</strong>. Please instruct how 'child_process' will added in gulpfile.</p>