Skip to content

Instantly share code, notes, and snippets.

@coderofsalvation
Created July 5, 2012 11:52
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coderofsalvation/3053260 to your computer and use it in GitHub Desktop.
Save coderofsalvation/3053260 to your computer and use it in GitHub Desktop.
winetalk - named pipes for communication between wine and linux bash
# setup named pipes for wine<->linux shell communication
#
# APPLICATIONS: glue linux & wine, use linux in .bat scripts, system() C-calls etc
# USAGE:
#
# [linux]
# mkfifo /tmp/wine_in
# mkfifo /tmp/wine_out
# ./winetalk /tmp/wine_in /tmp/wine_out
#
# [in wine (dos)]
# echo ls>z:\tmp\wine_in
# type z:\tmp\wine_out
#
test $# -eq 3 || echo "Usage: $0 <infifoname> <outfifoname>"; exit;
wine_in="$1"
wine_out="$2"
if [ ! -p "$wine_in" ]; then mkfifo "$wine_in"; fi
if [ ! -p "$wine_out" ]; then mkfifo "$wine_out"; fi
if [ ! -p "$wine_in" ]; then echo "[!] could not make '$wine_in'"; exit; fi
if [ ! -p "$wine_out" ]; then echo "[!] could not make '$wine_in'"; exit; fi
(while [ 1 ]; do
cat < "$wine_in" | while read line; do
cmd=$(printf "$line"| sed 's/\r//g'); ($cmd) > "$wine_out";
done;
done ) &
echo "[x] done setting up wine pipes '$1' and '$2'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment