summaryrefslogtreecommitdiff
path: root/src/spawn_sync.cc
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2015-05-14 11:46:54 -0600
committerTrevor Norris <trev.norris@gmail.com>2015-05-18 10:05:32 -0600
commitc1de6d249e9b17d53edc0a713c1e43ef9b457ea7 (patch)
treefba50f35b3a2266d52eb70cce48fcd7ac0eaf7cf /src/spawn_sync.cc
parent066274794c077c9323109f95ff0efe53e17d323a (diff)
downloadnode-new-c1de6d249e9b17d53edc0a713c1e43ef9b457ea7.tar.gz
core: implement runtime flag to trace sync io
Use the --trace-sync-io flag to print a stack trace whenever a sync method is used after the first tick, excluding during the process exit event. (e.g. fs.readFileSync()) It does not track if the warning has occurred at a specific location in the past and so will print the warning every time. Reason for not printing during the first tick of the appication is so all necessary resources can be required. Also by excluding synchronous calls during exit is necessary in case any data needs to be logged out by the application before it shuts down. Fixes: https://github.com/nodejs/io.js/issues/1674 PR-URL: https://github.com/nodejs/io.js/pull/1707 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Fedor Indutny <fedor@indutny.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Petka Antonov <petka_antonov@hotmail.com>
Diffstat (limited to 'src/spawn_sync.cc')
-rw-r--r--src/spawn_sync.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc
index 15e4fe8b10..79428fcd73 100644
--- a/src/spawn_sync.cc
+++ b/src/spawn_sync.cc
@@ -349,7 +349,9 @@ void SyncProcessRunner::Initialize(Handle<Object> target,
void SyncProcessRunner::Spawn(const FunctionCallbackInfo<Value>& args) {
- SyncProcessRunner p(Environment::GetCurrent(args));
+ Environment* env = Environment::GetCurrent(args);
+ env->PrintSyncTrace();
+ SyncProcessRunner p(env);
Local<Value> result = p.Run(args[0]);
args.GetReturnValue().Set(result);
}