mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-08 20:56:04 +00:00
Fix the Tab UI bug, and fix stdout/stderr clear issue
This commit is contained in:
parent
c411f596f9
commit
ff3cbd88dd
11
app/index.js
11
app/index.js
|
@ -124,8 +124,9 @@ myLayout.registerComponent('example', function(container, state) {
|
||||||
myLayout.init();
|
myLayout.init();
|
||||||
|
|
||||||
var addContentItem = function(title, text) {
|
var addContentItem = function(title, text) {
|
||||||
var newItemConfig = {
|
var contentItemConfig = {
|
||||||
title: title,
|
title: title,
|
||||||
|
id: title,
|
||||||
type: 'component',
|
type: 'component',
|
||||||
componentName: 'example',
|
componentName: 'example',
|
||||||
componentState: {
|
componentState: {
|
||||||
|
@ -133,7 +134,13 @@ var addContentItem = function(title, text) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
myLayout.root.contentItems[0].addChild(newItemConfig);
|
var contentItems = myLayout.root.getItemsById(title);
|
||||||
|
var contentItemsCount = contentItems.length;
|
||||||
|
if (contentItemsCount > 0) {
|
||||||
|
contentItems[0].element.show();
|
||||||
|
} else {
|
||||||
|
myLayout.root.contentItems[0].addChild(contentItemConfig);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// enable move the window with mouse drag and drop
|
// enable move the window with mouse drag and drop
|
||||||
|
|
|
@ -175,6 +175,9 @@ var HTTPObject = function(engine) {
|
||||||
} else {
|
} else {
|
||||||
this.setBinPath("bin\\x86\\curl-8.10.1_1-win32-mingw\\bin\\curl.exe");
|
this.setBinPath("bin\\x86\\curl-8.10.1_1-win32-mingw\\bin\\curl.exe");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// do not clear after calling the `exec`
|
||||||
|
this._interface.setIsPreventClear(true);
|
||||||
} else if (this.engine == "BITS") {
|
} else if (this.engine == "BITS") {
|
||||||
this._interface = SHELL.create();
|
this._interface = SHELL.create();
|
||||||
this.setBinPath("bitsadmin.exe"); // the location of BITS binary
|
this.setBinPath("bitsadmin.exe"); // the location of BITS binary
|
||||||
|
@ -715,7 +718,7 @@ var HTTPObject = function(engine) {
|
||||||
debuggingText = this._interface.stderr.read();
|
debuggingText = this._interface.stderr.read();
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear the stdout and stderr
|
// clear manually
|
||||||
this._interface.clear();
|
this._interface.clear();
|
||||||
} else if (this.engine == "BITS") {
|
} else if (this.engine == "BITS") {
|
||||||
var job_name = "welsonjs_" + PipeIPC.UUIDv4.create().substring(0, 8);
|
var job_name = "welsonjs_" + PipeIPC.UUIDv4.create().substring(0, 8);
|
||||||
|
@ -1172,7 +1175,7 @@ exports.parseURL = parseURL;
|
||||||
exports.DEFAULT_USER_AGENT = DEFAULT_USER_AGENT;
|
exports.DEFAULT_USER_AGENT = DEFAULT_USER_AGENT;
|
||||||
exports.defaultUserAgent = DEFAULT_USER_AGENT; // compatible
|
exports.defaultUserAgent = DEFAULT_USER_AGENT; // compatible
|
||||||
|
|
||||||
exports.VERSIONINFO = "HTTP REST Client (http.js) version 0.7.34";
|
exports.VERSIONINFO = "HTTP REST Client (http.js) version 0.7.35";
|
||||||
exports.AUTHOR = "abuse@catswords.net";
|
exports.AUTHOR = "abuse@catswords.net";
|
||||||
exports.global = global;
|
exports.global = global;
|
||||||
exports.require = global.require;
|
exports.require = global.require;
|
||||||
|
|
18
lib/shell.js
18
lib/shell.js
|
@ -12,6 +12,7 @@ var ShellObject = function() {
|
||||||
this.isElevated = false;
|
this.isElevated = false;
|
||||||
this.isFork = false;
|
this.isFork = false;
|
||||||
this.isVisibleWindow = false;
|
this.isVisibleWindow = false;
|
||||||
|
this.isPreventClear = false;
|
||||||
this.charset = PipeIPC.CdoUS_ASCII;
|
this.charset = PipeIPC.CdoUS_ASCII;
|
||||||
|
|
||||||
this.stdout = null;
|
this.stdout = null;
|
||||||
|
@ -39,6 +40,11 @@ var ShellObject = function() {
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.setIsPreventClear = function(flag) {
|
||||||
|
this.isPreventClear = flag;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
this.setWorkingDirectory = function(dirname) {
|
this.setWorkingDirectory = function(dirname) {
|
||||||
if (typeof(dirname) === "string") {
|
if (typeof(dirname) === "string") {
|
||||||
this.workingDirectory = dirname;
|
this.workingDirectory = dirname;
|
||||||
|
@ -95,10 +101,12 @@ var ShellObject = function() {
|
||||||
this.stdout.flush();
|
this.stdout.flush();
|
||||||
this.stderr.flush();
|
this.stderr.flush();
|
||||||
|
|
||||||
if (typeof stdOutPath === "string")
|
if (typeof stdOutPath === "string") {
|
||||||
this.stdout.startRecorder(stdOutPath, PipeIPC.ForWriting);
|
this.stdout.startRecorder(stdOutPath, PipeIPC.ForWriting);
|
||||||
if (typeof stdErrPath === "string")
|
}
|
||||||
|
if (typeof stdErrPath === "string") {
|
||||||
this.stderr.startRecorder(stdErrPath, PipeIPC.ForWriting);
|
this.stderr.startRecorder(stdErrPath, PipeIPC.ForWriting);
|
||||||
|
}
|
||||||
|
|
||||||
var c = "%comspec% /c (" + this.build(cmd) + ") 1> " + this.stdout.path;
|
var c = "%comspec% /c (" + this.build(cmd) + ") 1> " + this.stdout.path;
|
||||||
//c += " 2>&1";
|
//c += " 2>&1";
|
||||||
|
@ -118,6 +126,10 @@ var ShellObject = function() {
|
||||||
//console.log("[stdout] " + stdout);
|
//console.log("[stdout] " + stdout);
|
||||||
//console.log("[stderr] " + stderr);
|
//console.log("[stderr] " + stderr);
|
||||||
|
|
||||||
|
if (!this.isPreventClear) {
|
||||||
|
this.clear();
|
||||||
|
}
|
||||||
|
|
||||||
return stdout;
|
return stdout;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -224,7 +236,7 @@ exports.getPathOfMyDocuments = function() {
|
||||||
|
|
||||||
exports.CdoCharset = PipeIPC.CdoCharset;
|
exports.CdoCharset = PipeIPC.CdoCharset;
|
||||||
|
|
||||||
exports.VERSIONINFO = "Windows Shell Interface (shell.js) version 0.3.14";
|
exports.VERSIONINFO = "Windows Shell Interface (shell.js) version 0.3.15";
|
||||||
exports.AUTHOR = "abuse@catswords.net";
|
exports.AUTHOR = "abuse@catswords.net";
|
||||||
exports.global = global;
|
exports.global = global;
|
||||||
exports.require = global.require;
|
exports.require = global.require;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user