File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ class HttpToolkitServer extends Command {
43
43
async run ( ) {
44
44
const { flags } = this . parse ( HttpToolkitServer ) ;
45
45
46
+ this . setProcessTitle ( ) ;
47
+
46
48
this . cleanupOldServers ( ) ; // Async cleanup old server versions
47
49
48
50
await runHTK ( {
@@ -54,6 +56,20 @@ class HttpToolkitServer extends Command {
54
56
} ) ;
55
57
}
56
58
59
+ setProcessTitle ( ) {
60
+ if ( process . platform === 'win32' ) return ; // Not possible on Windows, as far as I can tell.
61
+
62
+ // Set the process title for easier management in activity monitor etc. This has some limitations,
63
+ // see https://nodejs.org/api/process.html#processtitle for details. In our case it's v likely to
64
+ // work regardless, as the full paths used in the desktop app are fairly long already, plus the
65
+ // path to the 'run' bin plus 'start', but we include a shorter fallback just in case too:
66
+ const currentProcessTitle = [ process . argv0 , ...process . argv . slice ( 1 ) ] . join ( ' ' ) ;
67
+ process . title = currentProcessTitle . length > 18
68
+ ? "HTTP Toolkit Server"
69
+ : "htk-server" ;
70
+
71
+ }
72
+
57
73
// On startup, we want to kill any downloaded servers that are not longer necessary
58
74
async cleanupOldServers ( ) {
59
75
if ( ! fs ) return ; // In node 8, fs.promises doesn't exist, so just skip this
You can’t perform that action at this time.
0 commit comments