Skip to content

Instantly share code, notes, and snippets.

@Vivek-V-N
Created January 10, 2017 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vivek-V-N/01ad01a65210d1fde3d964c4e3dd5ec6 to your computer and use it in GitHub Desktop.
Save Vivek-V-N/01ad01a65210d1fde3d964c4e3dd5ec6 to your computer and use it in GitHub Desktop.
const exec = require('child_process').exec;
StartMultipleTasks = () => {
new StartSingleTask(0).download();
new StartSingleErrorTask(1).download();
new StartSingleTask(2).download();
new StartSingleTask(3).download();
new StartSingleTask(4).download();
new StartSingleErrorTask(5).download();
new StartSingleTask(6).download();
new StartSingleErrorTask(7).download();
}
class StartSingleTask {
constructor(index) {
this.index = index;
}
download() {
exec('wget "http://www.w3schools.com/css/trolltunga.jpg" -O output1.jpg', function (error, stdout, stderr) {
if (error) {
console.log(this.index + " Failed");
return;
}
else
console.log(this.index + " Succeeded.");
}.bind(this));
}
}
class StartSingleErrorTask {
constructor(index) {
this.index = index;
}
download() {
exec('wget "http://www.w3schools.com/css/trolltunaga.jpg" -O output1.jpg', function (error, stdout, stderr) {
if (error) {
console.log(this.index + " Failed");
return;
}
else
console.log(this.index + " Succeeded.");
}.bind(this));
}
}
StartMultipleTasks();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment