Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hang-up issue #65

Merged
merged 2 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions wrappers/wine-msvc.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

%* %WINE_MSVC_ARGS% >%WINE_MSVC_STDOUT% 2>%WINE_MSVC_STDERR%
31 changes: 29 additions & 2 deletions wrappers/wine-msvc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,32 @@ while [ $# -gt 0 ]; do
ARGS+=("$a")
shift
done
WINEDEBUG=-all wine64 "$EXE" "${ARGS[@]}" 2> >(sed 's/\r//' | sed 's/z:\([\\/]\)/\1/i' | sed '/^Note:/s,\\,/,g' >&2) | sed 's/\r//' | sed 's/z:\([\\/]\)/\1/i' | sed '/^Note:/s,\\,/,g'
exit $PIPESTATUS

export WINE_MSVC_ARGS=$(printf ' "%s"' "${ARGS[@]}")

unixify_path='s/\r// ; s/z:\([\\/]\)/\1/i ; /^Note:/s,\\,/,g'

if [ -d /proc/$$/fd ]; then
exec {fd1}> >(sed -e "$unixify_path")
exec {fd2}> >(sed -e "$unixify_path" >&2)

export WINE_MSVC_STDOUT=/proc/$$/fd/$fd1
export WINE_MSVC_STDERR=/proc/$$/fd/$fd2
WINEDEBUG=-all wine64 'C:\Windows\System32\cmd.exe' /C $(dirname $0)/wine-msvc.bat "$EXE" &>/dev/null {fd1}>&- {fd2}>&-
else
export WINE_MSVC_STDOUT=${TMPDIR:-/tmp}/wine-msvc.stdout.$$
export WINE_MSVC_STDERR=${TMPDIR:-/tmp}/wine-msvc.stderr.$$

cleanup() {
wait
rm -f $WINE_MSVC_STDOUT $WINE_MSVC_STDERR
}

trap cleanup EXIT

cleanup && mkfifo $WINE_MSVC_STDOUT $WINE_MSVC_STDERR || exit 1

sed -e "$unixify_path" <$WINE_MSVC_STDOUT &
sed -e "$unixify_path" <$WINE_MSVC_STDERR >&2 &
WINEDEBUG=-all wine64 'C:\Windows\System32\cmd.exe' /C $(dirname $0)/wine-msvc.bat "$EXE" &>/dev/null
fi