36 Commits

Author SHA1 Message Date
Allan Odgaard
a7ca1f0fb3 Remove support for redirecting stderr to a file 2020-04-19 14:32:30 +07:00
Allan Odgaard
eead4102dc Do not require that _app_path is setup when calling relaunch 2017-10-08 09:00:32 +02:00
Allan Odgaard
c6e07fadf3 Accept additional application arguments for relaunch API
This allows us to indicate to the new instance why it was launched.
2017-10-08 08:53:12 +02:00
Allan Odgaard
8fe7681ebd Remove unnecessary include of oak/compat.h 2015-08-05 12:31:20 +02:00
Allan Odgaard
d550eae4a0 Remove legacy code for relaunching already running instance 2015-08-05 12:28:07 +02:00
Allan Odgaard
166eedbb72 Simplify relaunch code 2014-11-30 09:12:06 +07:00
Allan Odgaard
ebf20acc20 Prefer CFBundleShortVersionString over CFBundleVersion 2014-11-10 09:01:05 +01:00
Allan Odgaard
0d496ea58c Look for process id file from 2.0-alpha.9553 and earlier
This is only when updating from an earlier version: Previously we would not find the pid file from the old instance and thus not tell it to quit.
2014-08-07 12:03:21 +02:00
Allan Odgaard
cc7f149f52 Avoid using Application Support for temporary file
Since the user’s library folder might be on a network we should probably avoid writing to it unless strictly necessary.
2014-07-24 22:37:38 +02:00
Allan Odgaard
6359a2ef7c Use symbolic exit success/failure constants 2014-04-21 17:05:35 +07:00
Allan Odgaard
39b94e6ac3 Harmonize whitespace and add trailing newline 2014-04-14 14:26:52 +07:00
Allan Odgaard
d2305654ac Make redirect of stderr opt-in 2013-08-25 21:13:06 +02:00
Allan Odgaard
b48ec4e4b0 Improve implementation of kill_process_group_in_background 2013-07-26 22:46:44 +02:00
Allan Odgaard
eb6b0541b2 Move reader_t and process_t to command framework
These are now only used by the command framework and should soon be retired.
2013-05-16 21:36:49 +07:00
Allan Odgaard
28ab42bff9 Remove oak::command_t 2013-05-16 21:36:07 +07:00
Allan Odgaard
5eaa0a9d94 Remove “PWD API” for setting command working directory
Only the file browser and the ‘path_variables’ function (used for filters) made use of this method to set the working directory. Previously drop commands also used it, which is probably the only time we really need to set a working directory, as we provide the command with a relative file path.
2013-05-12 11:09:17 +07:00
Allan Odgaard
ccf2414768 Add pwd argument to command runner
Previously this was only possible to change by setting PWD in the passed-in environment.
2013-05-12 11:09:15 +07:00
Allan Odgaard
f69ac60b0c Limit file descriptors passed to child process
Instead of passing the file descriptor to the child, and have the child close it, we set FD_CLOEXEC on the file descriptor in the parent process.

While it limits the window in which another thread can fork() and cause the file descriptor to be “leaked”, it doesn’t eliminate the problem.
2013-03-10 16:07:10 +01:00
Allan Odgaard
50a7c17dbd Use initializer list with path::join 2013-02-12 11:09:24 +01:00
Allan Odgaard
c6f228fbdf Redirect stderr when LOG_PATH is set
You need to set this variable for launchd, so that it is inherited by TextMate. Unfortunately launchd only reads /etc/launchd.conf so unless you want to set this variable globally then you need to run something like the following before starting TextMate:

    launchctl setenv LOG_PATH "$HOME/Library/Logs"
2013-02-12 11:04:55 +01:00
Allan Odgaard
38dffa9dd1 Remove legacy code 2013-02-11 14:21:22 +01:00
Allan Odgaard
2f146e235f Discontinue support for OAK_ACTIVATE variable
This isn’t used by anything current.
2013-02-11 14:21:22 +01:00
Allan Odgaard
ad03811df0 Ensure session restore when relaunching
The user can manually disable session restore, which is undesired when relaunching due to a software update or installing a plug-in, so we now override the user’s choice for the new instance launched.
2013-02-11 14:21:22 +01:00
Allan Odgaard
e75e7ec8e5 Change text::format → std::to_string (C++11) 2013-02-08 11:20:34 +01:00
Allan Odgaard
0f4fc14462 Improve stability during quit
When we quit, objects with static storage are destroyed. Since the order is undefined, we basically cannot reference other objects in destructors, unless we own them or they are reference counted.

One case that seems to be an actual problem is the oak::process_t type — based on crash logs this often seems to be destroyed last, and it unregisters itself in its destructor, but using an object that it previously did not own (but obtained via a sort of factory function).
2013-01-12 13:09:16 +01:00
Allan Odgaard
c7971c5f63 Use range-based for instead of std::for_each 2012-09-20 12:22:21 +02:00
Allan Odgaard
d71b9ea324 Avoid using begin/endof with strings
Mainly this is just to phase out the use of these custom helpers.
2012-09-20 12:22:20 +02:00
Allan Odgaard
b2acb02a7f Use std::function with cf::callback_t 2012-09-09 16:22:19 +02:00
Allan Odgaard
4e2b5f91ca Process working directory not always setup
This is a fairly subtle bug: We were implicitly creating a temporary std::string object and requesting c_str from this object.

This C string’s lifetime was that of the temporary std::string, and as we did a lot of std::string creation in the following line, with the new libc++, there was a good chance that the temporary string buffer would be re-used and so, our working directory would be set to a bogus value.

This closes issue #329.
2012-08-30 15:46:42 +02:00
Jacob Bandes-Storch
c976bce24d Use 64-bit: use std::thread to avoid void* cast 2012-08-28 21:32:46 +02:00
Allan Odgaard
2307db6631 Allow relaunch without user interaction 2012-08-15 22:00:23 +02:00
Allan Odgaard
6a554d1c68 Retire code necessary to gracefully upgrade from r9110 2012-08-15 21:14:39 +02:00
Allan Odgaard
9e1d10b5f1 Remove debug output
I was initially under the impression that no data should be sent past EOF but from testing it is clear that this assumption is incorrect. It’s unimportant though as we do handle the case (though we didn’t initially, and that’s why I put in the fprintf, to verify the situation I guarded for actually was happening).
2012-08-15 15:58:38 +02:00
Allan Odgaard
e680130eaf Move oak::basic_environment to the io framework
Previously this was under the OakSystem framework which depends on the io framework meaning that the io framework itself was unable to obtain a basic environment, which is necessary for next commit.
2012-08-11 19:31:10 +02:00
Allan Odgaard
485bdde0f7 Move oak::c_array to oak/datatypes.h
This simple wrapper is useful in a few places so we shouldn’t need to depend on the OakSystem framework in order to use it.
2012-08-11 19:21:28 +02:00
Allan Odgaard
9894969e67 Initial commit 2012-08-09 16:25:56 +02:00