Skip to content

Commit

Permalink
Add error handling for #736
Browse files Browse the repository at this point in the history
  • Loading branch information
gnunn1 committed Feb 17, 2017
1 parent 03bcbaa commit 607bc78
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 4 additions & 3 deletions source/gx/terminix/closedialog.d
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ private:
// Create icons
IconTheme iconTheme = new IconTheme();
IconInfo iconInfo = iconTheme.lookupIcon("utilities-terminal", 16, cast(IconLookupFlags) 0);
pbTerminal = iconInfo.loadIcon();
tracef("Pixbuf width,height = %d,%d", pbTerminal.getWidth(), pbTerminal.getHeight());

if (iconInfo !is null) {
pbTerminal = iconInfo.loadIcon();
tracef("Pixbuf width,height = %d,%d", pbTerminal.getWidth(), pbTerminal.getHeight());
}
setAllMargins(getContentArea(), 18);
Box box = new Box(Orientation.VERTICAL, 6);

Expand Down
9 changes: 7 additions & 2 deletions source/gx/terminix/terminal/terminal.d
Original file line number Diff line number Diff line change
Expand Up @@ -2994,8 +2994,13 @@ public:
pid_t childPid;
bool result = isProcessRunning(childPid);

import std.file: read;
name = to!string(cast(char[])read(format("/proc/%d/cmdline", childPid)));
import std.file: read, FileException;
try {
name = to!string(cast(char[])read(format("/proc/%d/cmdline", childPid)));
} catch (FileException fe) {
name = _("Unknown");
warning(fe);
}
name = replace(name, "\0", " ");

return result;
Expand Down

0 comments on commit 607bc78

Please sign in to comment.