summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Bolte <sbolte@lavabit.com>2013-06-02 11:00:48 +0200
committerStefan Bolte <sbolte@lavabit.com>2013-06-02 11:00:48 +0200
commit08200c630597b21d3cc6168082d34b0840e8bc5e (patch)
tree6c908530e355f8121342326df2181762136eca5b
parentce5d278454826511b978bbfff21864ae7523db6d (diff)
downloaddwb-08200c630597b21d3cc6168082d34b0840e8bc5e.zip
Regression, don't wrap system.spawn
system.spawn blocks the main-thread when wrapped
-rw-r--r--scripts/lib/system.js32
-rw-r--r--src/scripts.c6
2 files changed, 4 insertions, 34 deletions
diff --git a/scripts/lib/system.js b/scripts/lib/system.js
deleted file mode 100644
index c9b87028..00000000
--- a/scripts/lib/system.js
+++ /dev/null
@@ -1,32 +0,0 @@
-(function() {
- Object.defineProperties(system, {
- "spawn" :
- {
- value : (function() {
- return function(command, onStdout, onStderr, stdin, environ, toStdin) {
- var stdout, stderr;
- return system._spawn(command,
- function(response) {
- var ret;
- stdout = response;
- if (onStdout)
- ret = onStdout.call(onStdout, response);
- return ret;
- },
- function(response) {
- var ret;
- stderr = response;
- if (onStderr)
- ret = onStderr.call(onStderr, response);
- return ret;
- },
- stdin, environ, toStdin).then(
- function() { return stdout; },
- function() { return stdin; }
- );
- };
- })()
- }
- });
- Object.freeze(system);
-})();
diff --git a/src/scripts.c b/src/scripts.c
index 8ed056e8..f8f02d4f 100644
--- a/src/scripts.c
+++ b/src/scripts.c
@@ -3195,13 +3195,15 @@ system_spawn(JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, siz
if (argc > 3)
pipe_stdin = js_value_to_char(ctx, argv[3], -1, exc);
+
if (argc > 4)
envp = get_environment(ctx, argv[4], exc);
if (!g_shell_parse_argv(cmdline, &srgc, &srgv, NULL) ||
!g_spawn_async_with_pipes(NULL, srgv, envp, G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
NULL, NULL, &pid,
- pipe_stdin != NULL ? &infd : NULL,
+ NULL,
+ //pipe_stdin != NULL ? &infd : NULL,
oc != NULL ? &outfd : NULL,
ec != NULL ? &errfd : NULL, NULL))
{
@@ -5016,7 +5018,7 @@ create_global_object()
* @static
* */
JSStaticFunction system_functions[] = {
- { "_spawn", system_spawn, kJSDefaultAttributes },
+ { "spawn", system_spawn, kJSDefaultAttributes },
{ "spawnSync", system_spawn_sync, kJSDefaultAttributes },
{ "getEnv", system_get_env, kJSDefaultAttributes },
{ "fileTest", system_file_test, kJSDefaultAttributes },