Skip to content

Commit

Permalink
Check that PR_SET_NAME is defined.
Browse files Browse the repository at this point in the history
Avoids breaking the build with older (pre-2006) linux kernels.
Raises a JS exception if the script tries to assign to `process.title`.

Fixes nodejs#840.
  • Loading branch information
bnoordhuis committed Jul 4, 2011
1 parent 8248dc6 commit 90cccf8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/platform_linux.cc
Expand Up @@ -64,9 +64,15 @@ char** Platform::SetupArgs(int argc, char *argv[]) {


void Platform::SetProcessTitle(char *title) {
#ifdef PR_SET_NAME
if (process_title) free(process_title);
process_title = strdup(title);
prctl(PR_SET_NAME, process_title);
#else
Local<Value> ex = Exception::Error(
String::New("'process.title' is not writable on your system, sorry."));
ThrowException(ex); // Safe, this method is only called from the main thread.
#endif
}


Expand Down

0 comments on commit 90cccf8

Please sign in to comment.