resolve single import vs. import from the same package
[fedora-idea.git] / native / restarter / restarter.cpp
blob65b1eb214a552fd596a7d037ccae9c6965a7043a
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "stdafx.h"
20 int _tmain(int argc, _TCHAR* argv[])
22 if (argc < 3) return 0;
23 int ppid = _ttoi(argv [1]);
24 HANDLE parent_process = OpenProcess(SYNCHRONIZE, FALSE, ppid);
25 if (parent_process)
27 WaitForSingleObject(parent_process, INFINITE);
28 CloseHandle(parent_process);
31 int rc = _texecv(argv [2], argv+2);
32 if (rc == -1)
34 _tprintf(_T("Error restarting process: errno is %d"), errno);
37 return 0;