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

Fixes 20130413 #213

Merged
merged 5 commits into from
Apr 23, 2013
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
2 changes: 1 addition & 1 deletion bin/vibe
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ cp -p "$VIBEPATH"/vpm.d /tmp/vpm.d
chmod 666 /tmp/vpm.d

# run VPM and delete the vpm.d file again, VPM will output the compile/run script
rdmd -g -w -property -version=VibeLibeventDriver -I"$VIBEPATH"/../source $LIBS -Jviews -Isource /tmp/vpm.d "$VIBEPATH" "$START_SCRIPT" $1 $2 $3 $4 $5 $6 $7 $8 $9
rdmd -g -w -property -version=VibeLibeventDriver -I"$VIBEPATH"/../source -I"$VIBEPATH"/../import $LIBS -Jviews -Isource /tmp/vpm.d "$VIBEPATH" "$START_SCRIPT" $1 $2 $3 $4 $5 $6 $7 $8 $9
rm /tmp/vpm.d

# compile/run the application
Expand Down
2 changes: 1 addition & 1 deletion bin/vibe.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ copy "%VIBE_BIN%vpm.d" %EXEDIR% > nul 2>&1
del %START_SCRIPT% >nul 2>&1

rem Run, execute, do everything.. but when you do it, do it with the vibe!
rdmd -debug -g -w -property -version=VibeLibeventDriver -of%EXEDIR%\vpm.exe -I%VIBE_BIN%..\source %LIBS% %EXEDIR%\vpm.d %VIBE_BIN% %START_SCRIPT% %*
rdmd -debug -g -w -property -version=VibeLibeventDriver -of%EXEDIR%\vpm.exe -I%VIBE_BIN%..\source -I%VIBE_BIN%..\import %LIBS% %EXEDIR%\vpm.d %VIBE_BIN% %START_SCRIPT% %*

rem Finally, start the app, if vpm succeded.
if %ERRORLEVEL% == 0 (
Expand Down
1 change: 1 addition & 0 deletions bin/vpm.d
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ int main(string[] args)
}
flags ~= "-g";
flags ~= "-I" ~ (vibedDir ~ ".." ~ "source").toNativeString();
flags ~= "-I" ~ (vibedDir ~ ".." ~ "import").toNativeString();
flags ~= "-Isource";
flags ~= "-Jviews";
flags ~= vpm.dflags;
Expand Down
9 changes: 6 additions & 3 deletions source/vibe/appmain.d
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,19 @@ int main()

lowerPrivileges();

logInfo("Running event loop...");
logDiagnostic("Running event loop...");
int status;
debug {
return runEventLoop();
status = runEventLoop();
} else {
try {
return runEventLoop();
status = runEventLoop();
} catch( Throwable th ){
logError("Unhandled exception in event loop: %s", th.toString());
return 1;
}
}
logDiagnostic("Event loop exited with status %d.", status);
return status;
}
}
1 change: 1 addition & 0 deletions source/vibe/core/core.d
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ private void setupDriver()
else version(VibeLibevDriver) setEventDriver(new LibevDriver(s_core));
else version(VibeLibeventDriver) setEventDriver(new Libevent2Driver(s_core));
else static assert(false, "No event driver is available. Please specify a -version=Vibe*Driver for the desired driver.");
logTrace("driver %s created", (cast(Object)getEventDriver()).classinfo.name);
}

private void workerThreadFunc()
Expand Down
4 changes: 3 additions & 1 deletion source/vibe/core/drivers/win32.d
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Win32EventDriver : EventDriver {
int runEventLoop()
{
m_exit = false;
while( !m_exit )
while( !m_exit && haveEvents() )
runEventLoopOnce();
return 0;
}
Expand Down Expand Up @@ -111,6 +111,8 @@ class Win32EventDriver : EventDriver {
return 0;
}

private bool haveEvents() { return !m_fileWriters.byKey.empty || !m_socketHandlers.byKey.empty; }

private void waitForEvents(uint timeout)
{
auto ret = MsgWaitForMultipleObjectsEx(cast(DWORD)m_registeredEvents.length, m_registeredEvents.ptr, timeout, QS_ALLEVENTS, MWMO_ALERTABLE|MWMO_INPUTAVAILABLE);
Expand Down
4 changes: 2 additions & 2 deletions tests/args/source/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import std.stdio;
shared static this()
{
string argtest;
getOption("argtest", &argtest);
getOption("argtest", &argtest, "Test argument");
writeln("argtest=", argtest);
}

void main()
{
finalizeCommandLineArgs();
finalizeCommandLineOptions();
}
2 changes: 1 addition & 1 deletion tests/args/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ fi

( $VIBE | grep -q '^argtest=$' ) || die "Fail (no argument)"
( $VIBE -- --argtest=aoeu | grep -q '^argtest=aoeu$' ) || die "Fail (with argument)"
( ( ! $VIBE -- --inexisting ) | grep -qF 'Unrecognized command-line parameter' ) || die "Fail (unknown argument)"
( ( ! $VIBE -- --inexisting 2>&1 ) | grep -qF 'Unrecognized command line option' ) || die "Fail (unknown argument)"

echo 'OK'