Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved get_pid function from Windows to framework, where it belongs. C…

…leaned up on_demand_stdin Windows' function
  • Loading branch information...
commit f1eb3772929e3c2d4b8d54dcabc2ed1148b0e816 1 parent 9692324
@tomas tomas authored
View
8 core/framework
@@ -133,7 +133,11 @@ number_of_instances_of(){
# returns pid for the requested process, expects the full process name
get_pid(){
- ps ax | grep -i "$1" | grep -v grep | head -1 | sed 's/ \?\([0-9]*\).*/\1/'
+ if [ "$os" == "windows" ]; then
+ tasklist | grep "$1" | head -1 | sed 's/[a-z\. ]*\([0-9]*\).*/\1/'
+ else
+ ps ax | grep -i "$1" | grep -v grep | head -1 | sed 's/ \?\([0-9]*\).*/\1/'
+ fi
}
# sends sigterm to specified process, unless a specific signal is passed as $2
@@ -145,4 +149,4 @@ term_process(){
# kills a specified process, expects the process name
kill_process(){
term_process "$1" -9
-}
+}
View
16 platform/windows/functions
@@ -14,10 +14,6 @@ run_as_current_user(){
fi
}
-get_pid(){
- $processes | grep "$1" | head -1 | sed 's/[a-z\. ]*\([0-9]*\).*/\1/'
-}
-
############################################
# verification stuff
############################################
@@ -106,16 +102,14 @@ reverse_tunnel_command(){
}
on_demand_stdin(){
- local sleep_interval=1
+ local sleep_interval=2
local last_msg=""
while sleep $sleep_interval; do
- if [ ! -e "$on_demand_pipefile" ]; then
- break
- fi
+ [ ! -e "$on_demand_pipefile" ] && break
+
local new_msg=`tail -1 "$on_demand_pipefile"`
- if [ "$new_msg" != "$last_msg" ]; then
- echo "$new_msg"
- fi
+ [ "$new_msg" != "$last_msg" ] && echo "$new_msg"
+
last_msg="$new_msg"
done
}
View
1  platform/windows/settings
@@ -9,7 +9,6 @@ readonly logged_user=`echo "ComputerSystem Get Username" | wmic 2> /dev/null | g
tmpbase="$WINDIR\Temp"
line_breaker="\r\n"
-processes='TASKLIST'
readonly required_net_version='2.0.50727'
readonly prey_reg_key="HKLM\Software\Prey"
Please sign in to comment.
Something went wrong with that request. Please try again.