Skip to content

Commit

Permalink
#55 silence meaningless warning from the scripting-bridge framework
Browse files Browse the repository at this point in the history
  • Loading branch information
koekeishiya committed Jun 24, 2019
1 parent 700c18b commit e1845ff
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Changed
- Hide power indicator from the status-bar if a battery could not be found [#60](https://github.com/koekeishiya/yabai/issues/60)
- Disable focus follows mouse while the *mouse_modifier* key is held down [#62](https://github.com/koekeishiya/yabai/issues/62)
- Silence meaningless warning reported by the scripting-bridge framework [#55](https://github.com/koekeishiya/yabai/issues/55)

## [1.0.1] - 2019-06-23
### Added
Expand Down
19 changes: 19 additions & 0 deletions src/osax/sa.m
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,16 @@ int scripting_addition_load(void)
{
if (!scripting_addition_is_installed()) return 1;

// temporarily redirect stderr to /dev/null to silence
// meaningless warning reported by the scripting-bridge
// framework, because Dock.app does not provide a .sdef

int stderr_fd = dup(2);
int null_fd = open("/dev/null", O_WRONLY);
fflush(stderr);
dup2(null_fd, 2);
close(null_fd);

// @memory_leak
// [SBApplication applicationWithBundleIdentifier] leaks memory and there is nothing we
// can do about it.. So much for all the automatic memory management techniques in objc
Expand All @@ -245,5 +255,14 @@ int scripting_addition_load(void)
[dock sendEvent:'YBSA' id:'load' parameters:0];
[dock release];


//
// restore stderr back to normal
//

fflush(stderr);
dup2(stderr_fd, 2);
close(stderr_fd);

return 0;
}

0 comments on commit e1845ff

Please sign in to comment.